package eda.main;


/**
 * Essa classe eh utilizada principalmente para obter informacoes que nao se tem de forma direta
 * na Tabela Hash, por exemplo, o tamanho atual da tabela, pois essas informacoes sao internas da Tabela.
 */

@SuppressWarnings("unchecked")
public class MainUtil{
	
	private Class keyClass;
	private Class valueClass;
	
	private int tableLength;
	
	private static double multiplicationConstant = (double)(Math.sqrt(5) - 1)/2;
	
	private int stringHashCode;
	
	public int getTableLength() {
		return tableLength;
	}

	public void setTableLength(int tableLength) {
		this.tableLength = tableLength;
	}
	
	public int getChainingHashPosition(int hashCode){
		return (int)(tableLength*((hashCode*multiplicationConstant) % 1));
		
	}
	
	public Class getKeyClass(){
		return keyClass;
	}
	
	public void setKeyClass(Class clazz){
		keyClass = clazz;
	}
	
	public Class getValueClass(){
		return valueClass;
	}
	
	public void setValueClass(Class clazz){
		valueClass = clazz;
	}

	public int getStringHashCode() {
		return stringHashCode;
	}

	public void setStringHashCode(int stringHashCode) {
		this.stringHashCode = stringHashCode;
	}
	
}